//
// Created by dxyinme on 2021/10/15.
//
#include "gtest/gtest.h"
#include "v_sort_test_comm.h"
#include "filesort/serializer.h"


class SerializerTest : public VsortTestComm {};

TEST_F(SerializerTest, TestNumberStrSmallCase) {
  std::string num[] = {
          "1230473",
          "23482396412921417462382397",
          "3249568342438423973472412939"
  };
  char s[] = "1230473\n23482396412921417462382397\n3249568342438423973472412939\n234740\0";
  auto* serializer = new Vsort::FileSort::Serializer(Vsort::FileSort::SerializerType::DivideOperator);
  serializer->ReadFromCharPtr(s);
  EXPECT_EQ(serializer->GetUnReadItemNum(), 3);
  auto unReadBufRef = serializer->UnReadBufRef();
  for (auto i = 0; i < unReadBufRef.size(); i++) {
    EXPECT_EQ(unReadBufRef[i], num[i]);
  }
}